package com.ruoyi.business.config;

import org.springframework.security.core.userdetails.User;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Component;

import java.util.Collections;

/**
 * Description：
 *	启动之后,进入列表页面会出现如下的错误	Caused by: org.springframework.security.core.userdetails.UsernameNotFoundException: 1
 * 原因是因为Activiti在代码中强耦合了SpringScurity,在使用
 * 会调用SpringScurity中的UserDetailsService类型的bean中的loadUserByUsername方法.然后是找不到
 * 的,所以报错了.我们需要调整的是,写一个类实现UserDetailsService然后重写loadUserByUsername方
 * 法
 *
 */
@Component
public class SelfUserDetailsServiceImpl implements UserDetailsService {
	@Override
	public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
		return new User(username,"", Collections.EMPTY_LIST);
	}
}
